package com.icity.service.impl;

import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.icity.entity.behavior.BehaviorEvent;
import com.icity.entity.behavior.BehaviorVisit;
import com.icity.entity.system.TableSupport;
import com.icity.mapper.BehaviorMapper;
import com.icity.service.BehaviorService;

@Service
public class BehaviorServiceImpl implements BehaviorService{

	@Autowired
	private BehaviorMapper behaviorMapper;

	@Override
	public TableSupport<?> getEventTable(Map<Object, Object> map) {
		TableSupport<BehaviorEvent> listTable = new TableSupport<BehaviorEvent>();
		List<BehaviorEvent> listEvent = behaviorMapper.getEventList(map);
		int count = behaviorMapper.getEventCount(map);
		listTable.setCode(0);
		listTable.setMsg(null);
		listTable.setCount(count);
		listTable.setData(listEvent);
		return listTable;
	}

	@Override
	public TableSupport<?> getVisitTable(Map<Object, Object> map) {
		TableSupport<BehaviorVisit> listTable = new TableSupport<BehaviorVisit>();
		List<BehaviorVisit> listVisit = behaviorMapper.getVisitList(map);
		int count = behaviorMapper.getVisitCount(map);
		listTable.setCode(0);
		listTable.setMsg(null);
		listTable.setCount(count);
		listTable.setData(listVisit);
		return listTable;
	}

}
